function output = diff_decode(input)
    output = zeros(length(input),1);
    output(1) = input(1);
    raw_i = real(input(1));
    raw_q = imag(input(1));
    for i = 2:length(input)
       if(xor(real(input(i)),imag(input(i)))==0)
           output(i) = xor(real(input(i)),raw_i) + 1i*xor(imag(input(i)),raw_q);
       else
           output(i) = xor(imag(input(i)),raw_q) + 1i*xor(real(input(i)),raw_i);
       end
       raw_i = real(input(i));
       raw_q = imag(input(i));
    end
end

